package mapdemo;

import java.util.*;

public class JapanLetterManagement {
	private List<JapanLetter> list;

	public JapanLetterManagement() {
		list = new LinkedList<>();
		list.add(new JapanLetter("a", "あ", "ア"));
		list.add(new JapanLetter("i", "い", "イ"));
		list.add(new JapanLetter("u", "う", "ウ"));
		list.add(new JapanLetter("e", "え", "エ"));
		list.add(new JapanLetter("o", "お", "オ"));
		Collections.shuffle(list);
	}
	
	public int test() {
		Scanner scan = new Scanner(System.in);
		
		int total = 0; 
		for (JapanLetter letter : list) {
			System.out.println("发音:" + letter.getPronounce());
			// 为真就显示平假名
			if (new Random().nextBoolean()) {
				System.out.print("请输入平假名:");
				String ping = scan.next();
				if (Objects.equals(ping, letter.getHiragana())) {
					total += 20;
				}else {
					System.out.println("错误");
				}
			}else {
				System.out.print("请输入片假名:");
				String pian = scan.next();
				if (Objects.equals(pian, letter.getKatakana())) {
					total += 20;
				}else {
					System.out.println("错误");
				}
			}
		}
		return total;
	}
	
}
